import { BaseEntity } from '../../base/entity/base';
import { Column, Entity } from 'typeorm';

/**
 * 分润记录
 */
@Entity('finance_profit')
export class FinanceProfitEntity extends BaseEntity {
  @Column({
    comment: '分润状态',
    dict: ['待结算', '已结算'],
    default: 0,
    nullable: true,
  })
  profitStatus: number;

  @Column({ comment: '分润时间', nullable: true })
  profitTime: Date;

  @Column({ comment: '关联订单ID', nullable: true })
  orderId: string;

  /* 总金额 */
  @Column({
    comment: '订单金额',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  totalAmount: number;

  /* 平台扣点 */
  @Column({
    comment: '平台扣点',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  platformDeduction: number;

  /* 商家到账 */
  @Column({
    comment: '商家到账',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  sellerAmount: number;

  /* 一级代理分润 */
  @Column({
    comment: '一级代理分润',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  level1Amount: number;

  /* 二级代理分润 */
  @Column({
    comment: '二级代理分润',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  level2Amount: number;

  /* 三级代理分润 */
  @Column({
    comment: '三级代理分润',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  level3Amount: number;

  @Column({
    comment: '费率',
    type: 'decimal',
    precision: 10,
    scale: 2,
    nullable: true,
  })
  platformRatio: number;
}
